<?php

if (!defined('access')){
	die ('Direct access Denied!');
} else {

	function DBConnector ($dbtype,$dbhost,$dbname,$dbuser,$dbpass){
		try {
			$GLOBALS['bdd'] = new PDO("$dbtype:host=$dbhost;dbname=$dbname",$dbuser,$dbpass);
		} catch (PDOException $e){
			die ('Error : '. $e->getMessage());
		}
	}

	function execQuery($query){
		$result = $GLOBALS['bdd']->query($query) or die (print_r($GLOBALS['bdd']->errorInfo()));
		
		return $result;
	}
}

?>